/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.stat;

import android.content.Context;
import android.text.TextUtils;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.json.JSONObject;

public class v implements Thread.UncaughtExceptionHandler {
    private static String a = "QException";
    private Context b = null;
    private Thread.UncaughtExceptionHandler c = null;
    private static String d = "";
    private static String e = "";

    public v(Context paramContext) {
        this.b = paramContext;
        this.c = Thread.getDefaultUncaughtExceptionHandler();
    }

    public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
        StringWriter localStringWriter = new StringWriter();
        PrintWriter localPrintWriter = new PrintWriter(localStringWriter);
        paramThrowable.printStackTrace(localPrintWriter);
        d = localStringWriter.toString();
        localPrintWriter.close();
        e = ai.s(this.b);
        ai.a(e, d);
        ac.a(this.b, 2000L);
        this.c.uncaughtException(paramThread, paramThrowable);
    }

    public static JSONObject a(String paramString) {
        JSONObject localJSONObject = null;
        try {
            if (TextUtils.isEmpty(d))
                d = ai.b(e);
            if ((!(TextUtils.isEmpty(d))) && (!(TextUtils.isEmpty(paramString)))) {
                localJSONObject = new JSONObject();
                localJSONObject.put(paramString, d);
            }
            d = "";
        } catch (Exception localException) {
            x.a(a, localException);
        } catch (Error localError) {
            x.a(a, localError);
        }
        return localJSONObject;
    }
}